package Operation;

import Book.Book;
import Book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-04-13
 * Time: 12:30
 */
public class AddOperation implements IOperation {
    @Override
    public void work(BookList book) {
        System.out.println("增加图书");
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入你要添加的书名");
        String name = scan.nextLine();
        System.out.println("请输入你要添加书名的作者");
        String author = scan.nextLine();
        System.out.println("请输入你要添加书名的类型");
        String type = scan.nextLine();
        System.out.println("请输入你要添加书名的价格");
        int price = scan.nextInt();
        //拿到这本书
        Book book1 = new Book(name,author,type,price);
        //把这本书放到有效数字下标
        book.setPos(book.getUsedSize(),book1);
        book.setUsedSize(book.getUsedSize()+1);
    }
}
